Skip to content

fix(thumbnail): translate package name and description#111

Merged
BlackHole1 merged 1 commit intomainfrom
busy-crow
Jan 5, 2026
Merged

fix(thumbnail): translate package name and description#111
BlackHole1 merged 1 commit intomainfrom
busy-crow

Conversation

@hyrious
Copy link
Contributor

@hyrious hyrious commented Jan 5, 2026

No description provided.

@hyrious hyrious requested a review from BlackHole1 as a code owner January 5, 2026 11:24
@hyrious hyrious requested review from crimx and l1shen January 5, 2026 11:24
@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

Summary by CodeRabbit

  • New Features

    • Project thumbnails now display localized names and descriptions for improved internationalization support.
  • Bug Fixes

    • Improved error handling when reading flow configurations, preventing failures when flow directories are unavailable.
  • Tests

    • Added comprehensive test coverage for thumbnail functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This PR introduces changes to thumbnail display name resolution and localization. The PkgData class's public field title is renamed to displayName, with initialization logic updated to use localized values with fallback to the package name. The Thumbnail class is updated to reference the renamed field. Error handling is added to the flows directory read operation. New test cases validate thumbnail creation and localization behavior, along with fixture files providing test data including a package manifest and localization strings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • crimx

Pre-merge checks

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the changes, such as how the translation feature works and why it was necessary.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title follows the required format with type and scope, and accurately describes the main changes of translating package display name and description.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/utils/thumbnail.test.ts (1)

5-16: LGTM! Test validates the localization flow.

The test effectively verifies that Thumbnail.create loads the fixture and provideThumbnail returns correctly localized fields.

Optional: Consider adding edge case tests

For more comprehensive coverage, you could add tests for:

  • Missing localization files (falls back to package name)
  • Unresolved localization tokens
  • Missing displayName field in manifest

These would help catch regressions, but the current smoke test is sufficient for the happy path.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb9e1f4 and c8fbf87.

📒 Files selected for processing (4)
  • src/utils/thumbnail.test.ts
  • src/utils/thumbnail.ts
  • tests/fixtures/oo_project_1/oo-locales/en.json
  • tests/fixtures/oo_project_1/package.oo.yaml
🧰 Additional context used
🧬 Code graph analysis (1)
src/utils/thumbnail.test.ts (2)
src/utils/thumbnail.ts (1)
  • Thumbnail (258-497)
tests/helper/fs.ts (1)
  • fixture (11-13)
🔇 Additional comments (5)
tests/fixtures/oo_project_1/oo-locales/en.json (1)

1-4: LGTM!

The locale fixture data is well-formed and provides the necessary localized strings for the test.

tests/fixtures/oo_project_1/package.oo.yaml (1)

1-4: LGTM!

The fixture manifest correctly uses localization tokens for displayName and description, which will be resolved by the test.

src/utils/thumbnail.ts (3)

346-346: Good defensive coding for optional flows.

Adding error handling with .catch(() => []) prevents failures when the flows directory doesn't exist or can't be read, treating flows as optional. This is a solid improvement.


566-566: Breaking change from title to displayName is complete and properly implemented.

The rename to displayName with localization support has been fully migrated across the codebase. The implementation correctly includes:

  • Property definition with optional type at line 566
  • Localization via the localize method with fallback to data.name at line 585
  • No remaining references to the old title property

281-281: Migration from title to displayName is complete and correct.

The change at line 281 correctly uses this.wsPkgData.displayName. The PkgData class properly defines this as a public property and initializes it in the constructor with this.displayName = this.localize(data.displayName) || data.name;. No remaining references to the old field pattern exist in the codebase.

@BlackHole1 BlackHole1 merged commit 9d540cb into main Jan 5, 2026
1 of 2 checks passed
@BlackHole1 BlackHole1 deleted the busy-crow branch January 5, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants